import Opt from '@/components/dt/info/Opt.js'
import dt from '@dt/dt'
import moment from 'moment'

class Column extends Opt {

  constructor() {
    super()
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [{
      type: 'index',
      title: '序号',
      width: 50,
      fixed: 'left',
      align: 'center'
    },
    {
      field: 'status',
      title: '状态',
      width: 100,
      align: 'center',
      cell: {
        value: (row) => {
          return dt.dictInfo().__value('userStatus', row.status)
        },
        text: {}
      },
    },
    {
      field: 'newRankName',
      title: '职级',
      minWidth: 150,
      align: 'center'
    },
    {
      field: 'effectDate',
      title: '生效日期',
      minWidth: 90,
      align: 'center',
      cell: {
        value: (row) => {
          return row.effectDate ? moment(row.effectDate).format('YYYY-MM-DD') : '-'
        },
        text: {}
      },
    }]
  }
}

export default Column